package com.baidu.day01;

import java.util.Scanner;

public class Demo07 {
    public static void main(String[] args) {
        double money = 10000.00;
        while (true) {
            System.out.println("欢迎使用本银行系统");
            System.out.println("请选择您的操作:" + "\n" + "1、查看余额" + "\n"+"2、存款" + "\n" + "3、取款" + "\n" + "4、退出系统");
            Scanner scanner = new Scanner(System.in);
            int userChoice = scanner.nextInt();
            switch (userChoice) {
                case 1:
                    System.out.println("余额为" + money);
                    break;
                case 2:
                    System.out.println("请输入存款金额");
                    double userInputMoney1 = scanner.nextDouble();
                    if (userInputMoney1 < 0) {
                        System.out.println("输入金额有误");
                    }else {
                        money += userInputMoney1;
                    }
                    break;
                case 3:
                    System.out.println("请输入取款金额");
                    double userInputMoney2 = scanner.nextDouble();
                    if (userInputMoney2 > money) {
                        System.out.println("余额不足");
                    }else  {
                        money -= userInputMoney2;
                    }
                    break;
                case 4:
                    System.out.println("感谢使用");
                    return;
            }
        }

    }
}
